﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using QLibrary.Engine;
using QModel;
using System.Collections.Generic;
using QLibrary.Helper;
using QService.Parser;

namespace QService.Service
{
    public class RRService
    {
        public static HttpEngine GetFeeds()
        {
            //1.paras
            Dictionary<string, object> paras = new Dictionary<string, object>();
            paras.Add("method", "feed.get");
            paras.Add("v", "1.0");
            paras.Add("type","10,11,20,21,22,23,30,31,32,33,34,35,36,40,41,50,51,52,53,54,55");
            paras.Add("api_key", Constants.RRkey);
            paras.Add("access_token", Constants.RROauthEntity.RRAccessToken);
            paras.Add("format", "JSON");
            paras.Add("sig", ParamHelper.GetRRSig(paras));
            CommonReqEntity reqEntity = new CommonReqEntity("", null, paras, HttpMethod.POST, PlatformType.RR);
            //2.parser
            FeedsParser feedsParser = new FeedsParser();
            QParser qparser = new QParser();
            feedsParser.NextParser = qparser;
            //3.Result
            Dictionary<string,object> resultData = new Dictionary<string,object>();
            List<FeedsEntity> feedsList = new List<FeedsEntity>();
            ErrorEntity errorEntity = new ErrorEntity();

            resultData.Add("FeedsList", feedsList);
            resultData.Add("ErrorEntity", errorEntity);

            return new HttpEngine(reqEntity, feedsParser, resultData);
        }
    }
}
